/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gravity;

import processing.core.PApplet;
import processing.core.PVector;

/**
 *
 * @author Juho
 */
public class GraphicsLibrary {

    public static final float arrowSize = 6;
    public static final int VELOCITY_VECTOR_SCALE_FACTOR = 10;
    public static final int ACCELERATION_VECTOR_SCALE_FACTOR = 10000;


    public static void drawVector(PApplet parent, PVector loc, PVector v, float scaleFactor) {
        // push matrix, relocate, rotate, draw arrow
        parent.pushMatrix();
        parent.translate(loc.x, loc.y);
        parent.rotate(v.heading2D());
        float length = v.mag() * scaleFactor;

        parent.line(0, 0, length, 0);
        parent.line(length, 0, length - arrowSize, +arrowSize/2);
        parent.line(length, 0, length - arrowSize, -arrowSize/2);

        parent.popMatrix();
    }



}
